#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int p1,p2,p3,n;
string s;
string ret;

//判断是否是数字
bool isdig(char ch)
{
    return ch >= '0' && ch <= '9';
}

//判断是否是小写字母
bool islet(char ch)
{
    return ch >= 'a' && ch <= 'z';
}

//[left,right]之间的字符进行展开
void add(char left,char right)
{
    string t;
    for(char ch = left + 1;ch < right; ch++)
    {
        //p1
        char tmp = ch;
        if(p1 == 2 && islet(tmp))
        {
            tmp -= 32;
        }
        else if(p1 == 3)
        {
            tmp = '*';
        }

        //p2
        for(int i = 0;i < p2;i++)
        {
            t += tmp;
        }
    }
    //p3
    if(p3 == 2)
    {
        reverse(t.begin(),t.end());
    }
    ret += t;
}

int main()
{
    cin >> p1 >> p2 >> p3 >> s;
    n = s.size();
    for(int i = 0;i < n; i++)
    {
        char ch = s[i];
        if(s[i] != '-' || i == 0 || i == n-1)
        {
            ret += ch;
        }
        else
        {
            char left = s[i - 1],right = s[i + 1];
            //判断是否展开
            if(isdig(left) && isdig(right) && right > left ||
               islet(left) && islet(right) && right > left)
            {
                //展开
                add(left,right);
            }
            else
            {
                ret += ch;
            }
        }
    }
    cout << ret << endl;
    return 0;
}